import { get, post } from "../utils/http";
// 登录
export function userlogin(username,password){
  return post("/api/login",{
    username,
    password
  })
}
// 注册
export function userregistered(username,password,phonenumber){
  return post("/api/reguser",{
    username,
    password,
    phonenumber
  })
}
// 忘记密码
export function userforget(username,phonenumber,newPwd){
  return post("/api/forgetPassword",{
    username,
    phonenumber,
    newPwd
  })
}
// 获取用户信息
export function getusername(){
  return get("/my/userinfo")
}
// 更新用户信息
export function userxiugai(like_table,phonenumber,address){
  return post("/my/changeUserInfo",{
    like_table,
    phonenumber,
    address
  })
}
// 修改密码
export function userchange(oldPwd,newPwd){
  return post("/my/updatepwd",{
    oldPwd,
    newPwd
  })
}
// 获取菜品分类
export function getfoodclass(){
  return post("/api/article/cateDele",{
    is_delete:0
  })
}
// 获取菜品信息
export function getfood(classification_id, pageNum){
  return post("/api/article/details",{
    classification_id,
    pageSize:999999999,
    pageNum
  })
}
// 获取推荐菜品信息
export function getrecommendfood(pageNum){
  return post("/api/article/recommend",{
    pageSize:999999999,
    pageNum
  })
}
// 查找菜品
export function searchfood(name){
  return post("/api/article/textFind",{
    food_name:name
  })
}
// 查看喜欢的菜品
export function likefood(){
  return get("/my/likeFoodView")
}

// 添加喜欢的菜品
export function addlikefood(food_id,name){
  return post("/my/likeFoodUpload",{
    food_id,
    name
  })
}
// 取消收藏
export function cancelfood(food_id){
  return post("/my/likeFoodDelete",{
    food_id
  }) 
}
// 加入购物车
export function addshop(food_id, name, num, price){
  return post("/my/info/shopAdd",{
    food_id,
    name,
    num,
    price
  })
}
// 查看购物车
export function getshop(){
  return get('/my/info/shopFind')
}
// 修改购物车
export function changeshop(food_id, name, num, price){
  return post('/my/info/shopModify',{
    food_id,
    name,
    num,
    price
  })
}
// 删除购物车中的单个菜品
export function deshop(food_id){
  return post('/my/info/shopDeleOnce',{
    food_id,
  })
}
// 下单
export function addinfo(food_all, dining, table_id, address, price, phone, time, note){
  return post('/my/info/addInfo',{
    food_all,
    dining,
    table_id,
    address,
    price,
    phone,
    time,
    note
  })
}
// 删除购物车
export function deleteshop(){
  return get('/my/info/shopDeleAll')
}
// 获取任务订单
export function getinfo(){
  return post('/my/info/userInfo',{
    pageSize:99999999,
    pageNum:1
  })
}
// 反馈
export function addmessage(info_id, message, food_all){
  return post('/my/info/feedbackAdd',{
    info_id,
    message,
    food_all 
  })
}
// 获取未使用座位信息
export function getseat(){
  return get('/my/info/tableInforUse')
}